﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Utils;

namespace Logic
{
    public class Docentes : Personas
    {
        private Data.Docentes _hnd_docentes = new Data.Docentes();

        private Data.Docentes HndDocentes
        {
            get { return _hnd_docentes; }
        }

        public Entities.Docente GetByLegajo(int legajo)
        {
            return HndDocentes.GetByLegajo(legajo);
        }

        public Entities.Collections.DocentesCollection GetCollection()
        {
            return HndDocentes.GetCollection();
        }

        private string Validate(Entities.Docente instance)
        {
            return base.Validate(instance).ToString();
        }

        public string Save(Entities.Docente instance)
        {
            string r = Validate(instance);

            if (r.IsEmptyString())
            {
                instance.Nombre = instance.Nombre.Trim();
                instance.Apellido = instance.Apellido.Trim();
                instance.Direccion = instance.Direccion.Trim();
                instance.Telefono = instance.Telefono.Trim();
                instance.Email = instance.Email.Trim();
                HndDocentes.Save(instance);
            }

            return r;
        }
    }
}
